<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Map" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@page isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <meta charset="UTF-8">
    <title>登陆成功</title>
</head>
<body>
<%
    Date date = new Date();
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String now = simpleDateFormat.format(date);
%>
<h1>恭喜${sessionScope.user.username}用户在<%=now%>登陆成功</h1>
<form action="exit" method="post">
    <input type="submit"  value="退出系统">
</form>
<p>在线登录人数：
    <%
        int count=0;
        Map<String,String> online = (Map<String, String>) application.getAttribute("online");
        for (Map.Entry<String,String> entry : online.entrySet()){
            System.out.println(entry.getKey()+"_"+entry.getValue());
            if (!entry.getValue().equals("游客")){
                count++;
            }
        }
        out.print(count);
    %>
</p>
</body>
</html>
